function sleep(ms) {
	var start = Date.now()
	while(Date.now() - start <= ms ) ; 
}

function sendAJAX(url){
	return new Promise((resolve, reject) => {
		const xhr = new XMLHttpRequest();
		xhr.responseType = 'json';
		xhr.open("GET", url);
		xhr.send();
        //处理结果
        xhr.onreadystatechange = function(){
        	if(xhr.readyState === 4){
                //判断成功
                if(xhr.status >= 200 && xhr.status < 300){
                    //成功的结果
                    resolve(xhr.response, xhr.status, xhr);
                }else{
                	reject(xhr.status, xhr);
                }
            }
        }
    });
}

